<?php

function process_options_array($array) {//处理一下网站设置的数组
    foreach ($array as $key => $val) {

        $option[$val["option_name"]] = $val["option_value"];
    }
    return $option;
}

function get_segment_fuc($seg_num) {
    $CI = & get_instance();
    if ($CI->uri->segment($seg_num) === FALSE) {
        return;
    } else {
        $id = $CI->uri->segment($seg_num);
        if (is_numeric($id)) {
            return $id;
        } else {
            return;
        }
    }
}
function get_menu_array($class_name) {
    $CI = & get_instance();
    $CI->load->database();
    $sql = "select * from menu where controller_name=\"{$class_name}\"";
    $query = $CI->db->query($sql);
    return $res = $query->result_array();
}

function func_getphotos_byalbumid_test($albumid) {
    $CI = & get_instance();
    $CI->load->database();
    $sql="select * from photos where album_id=\"{$albumid}\"";//获取满足分类的全部数据
    $query = $CI->db->query($sql);
  $res = $query->result_array();
  $change_arr=array();
  
  foreach($res as $key=>$val){
      
     $change_arr[$key]=$val["id"];
  }
  return  $change_arr;
}

function isLogin(){
    if($_SESSION["statue"]=="login"){        
        return TRUE;
        
    }else{
       $CI = & get_instance();
      $CI->load->helper('url'); 
      redirect("admin/admin/login");
      
    }
    
    
    
}












?>
